<?php
/**
 * Created by LíJimpéy(：
 * User: jimpey88
 * Date: 2024/3/28
 * Email: < jimpey@qq.com >
 * Project: company-admin-tp6
 */

namespace app\backend_api\exception;

use Throwable;

class AdminApiException extends \RuntimeException
{
    public function __construct($message, $code = 702, Throwable $previous = null)
    {
        if(is_array($message)){
            $errInfo = $message;
            $message = $errInfo[1] ?? '未知错误';
            if ($code === 0) {
                $code = $errInfo[0] ?? 400;
            }
        }

        parent::__construct($message, $code, $previous);
    }

}